# 小米上新
import time

from appium.webdriver.common.appiumby import AppiumBy

from basic.base_page import BasePage
from page.page_shopping.page_service_shopping import PageShopping


class PageNewArrivalsMI(BasePage):



    def new_calendar_update_goto_shopping_cart(self):
        new_calendar_locator = "new UiSelector().className(\"android.view.ViewGroup\").instance(28)"
        calendar_list_locator = "new UiSelector().className(\"android.view.ViewGroup\").instance(39)"
        detailed_list_locator = "new UiSelector().resourceId(\"com.xiaomi.shop:id/content_container\").instance(0)"
        # 点击新日历更新
        self._click(new_calendar_locator, wait=5)
        time.sleep(5)
        # 点击日历列表
        self._click(calendar_list_locator, wait=5)
        # 点击详细列表
        self._click(detailed_list_locator, wait=5)

        return PageShopping()



    def new_product_list_goto_shopping_cart(self):
        pass

if __name__ == '__main__':
    from page.page_main import PageMain
    page_main = PageMain()
    page_main.goto_new_arrivals().new_calendar_update_goto_shopping_cart()
